﻿<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" 
				   default-lazy="false" 
				   assembly="Triton.Modules.Location" 
				   namespace="Triton.Location.Model">
	<class name="Triton.Location.Model.City, Triton.Modules.Location" table="cities" xmlns="urn:nhibernate-mapping-2.2">
		<id name="Id" column="id" type="Int32">
			<generator class="hilo" />
		</id>
		<version name="Version" column="version" type="int" />
		
		<property name="Name" column="name" type="String" length="255" unique="true"/>
		
		<bag name="PostalCodes" table="city_postalcodes" generic="true">
			<key column="city_id" foreign-key="FK_City_Postal_Codes"/>
			<many-to-many class="Triton.Location.Model.PostalCode, Triton.Modules.Location" column="postal_code_id" foreign-key="FK_Postal_Code_Cities"/>
		</bag>

		<component class="Triton.Location.Model.GeoLocation, Triton.Modules.Location" name="GeoLocation">
			<property column="longitude" name="Longitude" type="float"/>
			<property column="latitude" name="Latitude" type="float"/>
			<property column="elevation" name="Elevation" type="float"/>
		</component> 
	</class>
</hibernate-mapping>